package org.extreme.model.managers;

import org.extreme.model.base.DynamicValueList;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;

@Root
public class ReportWidthHeightManagerImp implements ReportWidthHeightManager {
	@Element
	private DynamicValueList columnWidthList = null;
	@Element
	private DynamicValueList rowHeightList = null;
	
	public ReportWidthHeightManagerImp() {
		this.columnWidthList = new DynamicValueList(DEFAULT_COL_WIDTH, 50);
		this.rowHeightList = new DynamicValueList(DEFAULT_ROW_HEIGHT, 50);
	}
	
	public DynamicValueList getRowHeightList() {
		return this.rowHeightList;
	}

	public int getRowHeight(int row) {
        return this.getRowHeightList().get(row);
    }

    public void setRowHeight(int row, int newValue) {
        if (newValue < 0) {
            newValue = 0;
        }

        this.getRowHeightList().set(row, newValue);
    }
    
    public DynamicValueList getColWidthList() {
    	return this.columnWidthList;
    }
    
    public int getColWidth(int col) {
        return this.getColWidthList().get(col);
    }

    public void setColWidth(int col, int newValue) {
        if (newValue < 0) {
            newValue = 0;
        }

        this.getColWidthList().set(col, newValue);
    }

}
